package cn.zhb.backend.core.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.hibernate.annotations.Comment;

import javax.persistence.*;

/***
 *@Description
 *@Author ZHB
 *@Create 2025/7/3 下午4:26
 **/
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@Entity
@Table(name = "bus_question")
@TableName("bus_question")
@ApiModel(description = "题目")
public class Question extends BaseEntity{

    @ApiModelProperty("题目标题")
    @Column(name = "title", nullable = false)
    @TableField(value = "title")
    private String title;

    @ApiModelProperty("题目内容")
    @Column(name = "content")
    @TableField(value = "content")
    private String content;

    @ApiModelProperty("图片存放路径")
    @Column(name = "image_path")
    @TableField(value = "imagePath")
    private String imagePath;

    @ApiModelProperty("答案")
    @Column(name = "answer", nullable = false)
    @TableField(value = "answer")
    private String answer;

    // 多对一：一个题目属于一个分类
    @ApiModelProperty("所属分类")
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "category_id", nullable = false)
    @TableField(exist = false)
    private Category category;

    @ApiModelProperty("所属分类ID")
    @Column(name = "category_id", insertable = false, updatable = false)
    @TableField("categoryId")
    private Long categoryId;

}
